<template>
	<view>
		<view class="heads uniFlex">
			<image v-if="user.head" :src="user.head" mode=""></image>
			<image v-else src="../../static/img/head.png" mode=""></image>
			<view class="headmsg">
				<view>{{user.name}}</view>
				<view>ID：{{user.id}}</view>
				<view>等级：{{user.daili_dengji}}</view>
			</view>
		</view>
		
		<view class="boxes uniBtn">
			<view class="box">
				<view>累计收益</view>
				<view>￥{{user.daili_price}}</view>
			</view>
			<u-line direction="col" length="99upx"></u-line>
			<view class="box">
				<view>我的邀请</view>
				<view>{{user.daili_num}}</view>
			</view>
		</view>
	
		<view class="bottomcontent">
			<view class="boxitem" v-for="(item,index) in itemList" :key="index" @click="tabs(item.title)">
				<image :src="item.icon" mode=""></image>
				<view>{{item.title}}</view>
			</view>
			<!-- <view class="boxitem">
				<image src="../../static/main/a2.png" mode=""></image>
				<view>推广链接</view>
			</view>
			<view class="boxitem">
				<image src="../../static/main/a3.png" mode=""></image>
				<view>收益记录</view>
			</view>
			<view class="boxitem">
				<image src="../../static/main/a4.png" mode=""></image>
				<view>提现记录</view>
			</view>
			<view class="boxitem">
				<image src="../../static/main/a5.png" mode=""></image>
				<view>利润设置</view>
			</view>
			<view class="boxitem">
				<image src="../../static/main/a6.png" mode=""></image>
				<view>余额记录</view>
			</view> -->
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				user:{
					head: '',
					name: '',
					id: '',
					daili_dengji: '',
					price2: '',//余额
					money: '',//消费金额
					count: '',//充值次数
					daili_num: '',//推荐人数
					daili_price: '',//代理收益
				},
				itemList:[
					{title:'推广二维码',icon:'../../static/main/a1.png'},
					{title:'推广链接',icon:'../../static/main/a2.png'},
					{title:'收益记录',icon:'../../static/main/a3.png'},
					{title:'提现记录',icon:'../../static/main/a4.png'},
					{title:'利润设置',icon:'../../static/main/a5.png'},
					{title:'余额明细',icon:'../../static/main/a6.png'}
				]
			}
		},
		onLoad() {
			this.getMsg()
		},
		methods: {
			// 获取个人信息
			async getMsg(){
				let res = await this.$api.getinfo({
					uid: uni.getStorageSync("tokenUid")
				});
				if(res.code == 200){
					// console.log(res)
					this.user = res.data;
				}
			},
			tabs(title){
				console.log(title)
				if(title=='推广二维码'){
					uni.navigateTo({
						url:'/pages/agent/shareImg/shareImg'
					})
				}else if(title=='推广链接'){
					uni.showToast({
						title:'暂未开放',
						icon:'none'
					})
					return
					uni.navigateTo({
						url:'/pages/agent/shareCode/shareCode'
					})
				}else if(title=='收益记录'){
					uni.navigateTo({
						url:'/pages/agent/income/income'
					})
				}else if(title=='提现记录'){
					uni.showToast({
						title:'暂未开放',
						icon:'none'
					})
					return
					uni.navigateTo({
						url:'/pages/agent/draw/draw'
					})
				}else if(title=='利润设置'){
					uni.showToast({
						title:'暂未开放',
						icon:'none'
					})
					return
					uni.navigateTo({
						url:'/pages/agent/profit/profit'
					})
				}else if(title=='余额明细'){
					uni.navigateTo({
						url:'/pages/agent/balance/balance'
					})
				}
			}
		}
	}
</script>

<style scoped lang="scss">
	.bottomcontent{
		display: flex;
		flex-wrap: wrap;
		box-sizing: border-box;
		padding: 40upx 0;
		background: #fff;
		
		.boxitem{
			width: 250upx;
			text-align: center;
			margin: 30upx 0;
			
			image{
				width: 77upx;
				height: 77upx;
				margin-bottom: 22upx;
			}
		}
	}
	.boxes{
		background: #fff;
		padding:30upx;
		margin: 20upx 0;
		
		.box{
			width: 49.8%;
			text-align: center;
			
			view:first-child{
				font-size: 24upx;
				margin-bottom: 6upx;
			}
			view:last-child{
				font-size: 34upx;
				font-weight: bold;
			}
		}
	}
	
	.heads {
		padding: 60upx 30upx;

		image {
			width: 115upx;
			height: 115upx;
			margin-right: 20upx;
			border-radius: 50%;
		}
		.headmsg{
			font-size: 24upx;
			color: #676769;
			line-height: 155%;
			view{
				&:nth-child(1){
					font-size: 30upx;
					color: #000;
					font-weight: bold;
				}
			}
		}
	}
</style>
